<template>
  <el-form ref="form" :model="form" :rules="rules" label-width="80px">
    <el-row>
      <el-col :span="12">
        <el-form-item label="学院" prop="collegeName">
          <span>{{ form.collegeName }}</span>
        </el-form-item>
      </el-col>

      <el-col :span="12">
        <el-form-item label="工号" prop="jobNumber">
          <span>{{ form.jobNumber }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="教师姓名" prop="teacherName">
          <span>{{ form.teacherName }}</span>
        </el-form-item>
      </el-col>

      <el-col :span="12">
        <el-form-item label="教师性别" prop="teacherSex">
          <dict-tag
            :type="DICT_TYPE.SYSTEM_USER_SEX"
            :value="form.teacherSex"
          />
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="年龄" prop="teacherAge">
          <span>{{ form.teacherAge }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="出生日期" prop="teacherBirthday">
          <span>{{ parseTime(form.teacherBirthday, "{y}-{m}-{d}") }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="联系电话" prop="teacherTelephone">
          <el-input
            v-model="form.teacherTelephone"
            placeholder="请输入联系电话"
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="法名" prop="legalName">
          <span>{{ form.legalName }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="微信号">
          <span>{{ form.wechat }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="民族">
          <span>{{ form.nation }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="籍贯">
          <span>{{ form.natively }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="职称" prop="post">
          <dict-tag
            :type="DICT_TYPE.TEACHER_PROFESSOR_TYPE"
            :value="form.post"
          />
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="研究方向">
          <span>{{ form.researchDirection }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="聘用时间" prop="employTime">
          <span>{{ parseTime(form.employTime, "{y}-{m}-{d}") }}</span>
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="聘用类型" prop="employType">
          <dict-tag
            :type="DICT_TYPE.TEACHER_RECRUIT_TYPE"
            :value="form.employType"
          />
        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="12">
        <el-form-item label="教师简介" prop="remark">
          <el-input
            v-model="form.teacherIntroduce"
            type="textarea"
            placeholder="请输入教师简介"
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="备注" prop="remark">
          <el-input
            v-model="form.remark"
            placeholder="请输入备注"
            type="textarea"
          />
        </el-form-item>
      </el-col>
    </el-row>
    <el-form-item>
      <el-button type="primary" size="mini" @click="submit">保存</el-button>
      <el-button type="danger" size="mini" @click="close">关闭</el-button>
    </el-form-item>
  </el-form>
</template>
  
  <script>
import { updateTeacherProfile } from "@/api/system/user";

export default {
  props: {
    form: {
      type: Object
    }
  },
  data() {
    return {

    };
  },
  methods: {
    submit() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          updateTeacherProfile(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
          });
        }
      });
    },
    close() {
      this.$tab.closePage();
    }
  }
};
  </script>
  